<template>
  <wrap title="授权结果" oneScreen>
    <div slot="page" class="light-bg" style="min-height:100%">
      <div v-if="baitiaoQuota>0">
        <div class="status flex flex-col flex-justify-center flex-align-center">
          <i class="fa fa-check-circle green fa-5x" aria-hidden="true"></i>
          <p class="font-16 text-center font-16">授权成功</p>
          <p class="grey-6 margin-top font-14">冻结白条额度</p>
          <p class="grey-6 margin-top font-18">￥&nbsp;<span class="font-30">{{baitiaoQuota}}</span></p>
        </div>
        <div class="fill-btn-box">
          <a class="fill-btn flex flex-center red-bg" @click="toRent()">
            <span class="light font-18">完成</span>
          </a>
        </div>
      </div>
      <!-- <div ></div> -->
    </div>
  </wrap>  
</template>
<script>
  import wrap from '../../components/wrap.vue'
  export default {
    components: {wrap},
    data () {
      return {
        authorizeId: '',
        subId: '',
        baitiaoQuota: 0,
        fromQR: false
      }
    },
    created () {
      const self = this
      self.authorizeId = self.$route.params.authorizeId ? self.$route.params.authorizeId : ''
      self.subId = self.$route.query.subId ? self.$route.query.subId : ''
      self.fromQR = self.$route.query.fromQR ? self.$route.query.fromQR : false
      self.fetchData()
      // self.baitiaoQuota = self.$route.params.baitiaoQuota ? self.$route.query.baitiaoQuota : 0
    },
    methods: {
      fetchData () {
        const self = this
        self.$Indicator.open()
        self.$api.auth.getAuthorizeQuota(self.authorizeId).then(res => {
          self.$Indicator.close()
          if (res.code === 0) {
            self.baitiaoQuota = res.data
          } else {
            self.$Toast(res.userMsg ? res.userMsg : res.msg)
          }
        }).always(function () {
          self.$Indicator.close()
        })
      },
      toRent () {
        if (this.fromQR) {
          window.location.href = 'https://m.9ji.com'
        } else {
          let href = process.env.NODE_ENV === 'production' ? window.location.host.indexOf('test') === -1 ? 'https://zu.9ji.com' : 'https://testzu.9ji.com' : 'http://10.1.14.173:90'
          window.location.href = href + '/counter/pay?id=' + this.subId
        }
      }
    }
  }
</script>
<style scoped>
  .status {
    padding: 30px 20px;
  }
  .status i {
    font-size: 90px;
    margin-bottom: 20px;
  }
  .text-center {
    text-align: center;
  }
  .tip{line-height: 20px;text-align: center;font-size: 12px;}
</style>


